<template>
	<view class="box">
		<view class="header">
			{{title}}
		</view>
		<view class="list" v-for="item in list.children">
			<view class="li" @click="goUnit(item)">
				<view class="left">
					{{item.name}}
				</view>
				<view class="right">
					<image src="https://s1.ax1x.com/2022/11/26/ztawa6.jpg" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				title:'',
				list:{}
			}
		},
		onLoad(option){
			console.log(JSON.parse(option.building));
			this.list = JSON.parse(option.building)
			this.title = this.list.name
		},
		methods:{
			goUnit(e){
				console.log(e);
				this.title += e.name
				uni.navigateTo({
					url:`/pages/mine/houseunit/houseunit?unit=${JSON.stringify(e)}&title=${this.title}`
				})
			}
		}
	}
</script>

<style lang="less">
	.header{
		width: 100%;
		height: 82rpx;
		background-color: #f0f0f0;
		padding: 0 30rpx;
		line-height: 82rpx;
	}
	.list{
		.li{
			width: 720rpx;
			height: 99rpx;
			border-bottom: 1rpx solid #f0f0f0;
			margin-left: 30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			
			.right{
				image{
					width: 25rpx;
					height: 25rpx;
					margin-right: 20rpx;
				}
			}
		}
	}
</style>